
version 15
capture log close
set more off
clear
clear matrix
clear mata

if c(username)=="WB485280" {
		glo rootdir		"C:\Users\wb485280\OneDrive - WBG\radicalization"
		}
if c(username)=="WB382635" {
		glo rootdir		"C:\Users\wb382635\Dropbox\Unemp & daesh"
		}
if c(username)=="WB452275" {
		glo rootdir		"C:\Users\WB452275\Dropbox\Projects\Unemp & daesh"
		}
if c(username)=="sarurchaudhary" {
		glo rootdir		"/Users/sarurchaudhary/Dropbox/Unemp & daesh"
		}
if c(username)=="kartikabhatia" {
			glo rootdir		"/Users/kartikabhatia/Dropbox/Before2019/Unemp & daesh"
			}
			
		glo	datadir     "${rootdir}/Data/Raw data"
		glo outdir		"${rootdir}/Data/Working datasets"
		glo dodir		"${rootdir}/Dofiles"
        
		cd "${outdir}"
		
	    log using pewrelg_prep, replace t

* ------------------------------------------------------------------------------
* Date : July 2017 [chkd oct 2021]


* Project : Working Paper, MEM (MNACE, The World Bank)


* This do file prepares the Pew religion database for merge

* Database used : PublicDataSet_ReligiousRestrictions_2007to2014.dta


* Output : pewrelg.dta

* ------------------------------------------------------------------------------
use "${datadir}/PublicDataSet_ReligiousRestrictions_2007to2014.dta"

rename Ctry_EditorialName countryname
rename Question_Year year

sort countryname, stable

drop if countryname=="Antigua and Barbuda"
drop if countryname=="Andorra"
drop if countryname=="Bahamas"
drop if countryname=="Barbados"
replace countryname="Bosnia and Herzegovina" if countryname == "Bosnia-Herzegovina"
drop if countryname=="Brunei"
replace countryname="Myanmar" if countryname == "Burma (Myanmar)"
drop if countryname=="Cape Verde"
replace countryname = "Congo Kinshasa" if countryname =="Democratic Republic of the Congo"
drop if countryname=="Dominica"
replace countryname ="Egypt, Arab Rep." if countryname =="Egypt"
drop if countryname=="Federated States of Micronesia"
drop if countryname=="Fiji"
replace countryname ="Gambia, The" if countryname =="Gambia"
drop if countryname=="Grenada"
replace countryname ="Hong Kong SAR, China" if countryname=="Hong Kong"
replace countryname ="Iran, Islamic Rep." if countryname=="Iran"
drop if countryname=="Kiribati"
replace countryname ="Kyrgyz Republic" if countryname=="Kyrgyzstan"
replace countryname ="Lao PDR" if countryname=="Laos"
drop if countryname=="Liechtenstein"
drop if countryname=="Macau"
drop if countryname=="Maldives"
drop if countryname=="Marshall Islands"
drop if countryname=="Monaco"
drop if countryname=="Nauru"
drop if countryname=="Palau"
replace countryname ="Palestine" if countryname=="Palestinian territories"
drop if countryname=="Papua New Guinea"
replace countryname ="Macedonia, FYR" if countryname=="Republic of Macedonia"
replace countryname ="Congo Brazzaville" if countryname=="Republic of the Congo"
replace countryname ="Russian Federation" if countryname=="Russia"
drop if countryname=="Samoa"
drop if countryname=="San Marino"
drop if countryname=="Sao Tome and Principe"
drop if countryname=="Seychelles"
replace countryname ="Slovak Republic" if countryname=="Slovakia"
drop if countryname=="Solomon Islands"
drop if countryname=="St. Kitts and Nevis"
drop if countryname=="St. Lucia"
drop if countryname=="St. Vincent and the Grenadines"
drop if countryname=="Timor-Leste"
drop if countryname=="Tuvalu"
drop if countryname=="Vanuatu"
drop if countryname=="Western Sahara"
replace countryname ="Syrian Arab Republic" if countryname=="Syria"
drop if countryname=="Tonga"
replace countryname ="Venezuela, RB" if countryname=="Venezuela"
replace countryname ="Yemen, Rep." if countryname=="Yemen"



insobs 5, before(1)
 replace countryname = "Nagorno Karabakh" in 1
 replace year = 2010 in 1
 replace countryname = "Northern Cyprus" in 2
 replace year = 2010 in 2
 replace countryname = "Puerto Rico" in 3
 replace year = 2010 in 3
 replace countryname = "Somaliland" in 4
 replace year = 2010 in 4
 replace countryname = "North Korea" in 5
 replace year = 2010 in 5




sort countryname, stable
encode countryname, gen(ctry)
sort ctry year
sort countryname year


save "${outdir}/pewrelg.dta", replace

log close




















